package com.codebattery.repository;

import com.codebattery.domain.entity.Dict;
import com.codebattery.domain.model.DeviceInfo;
import com.codebattery.domain.model.DictInfo;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;

public interface DictRepository extends JpaRepository<Dict, Integer>, JpaSpecificationExecutor<Dict> {

    @Query(value="SELECT new com.codebattery.domain.model.DictInfo("
            +"id, value, text, status, remark, group "
            + ") FROM "
            + " com.codebattery.domain.entity.Dict d ")
    Page<DictInfo> queryDicts(Pageable pageable);

}